﻿using Microsoft.EntityFrameworkCore;
using ShopSystem.Core.Base.Repository.Base;
using ShopSystem.Model.Context;
using ShopSystem.Model.Entities.Base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ShopSystem.Core.Repository.Base
{
    public class BaseRepository<TEntity> : IBaseRepository<TEntity> where TEntity : BaseEntity
    {
        private readonly ShopDbContext db;
        private readonly DbSet<TEntity> DbSet;
        public BaseRepository(ShopDbContext db) 
        {
            this.db = db;
            DbSet = this.db.Set<TEntity>();
        }
        public async Task Delete(int id, bool saved = true)
        {
            DbSet.FindAsync();
            DbSet.Remove();
           await ;
            if (saved) await SaveChanges();
        }

        public Task Insert(TEntity obj, bool saved = true)
        {
            throw new NotImplementedException();
        }

        public Task<IQueryable<TEntity>> Query()
        {
            throw new NotImplementedException();
        }

        public Task<TEntity> Query(int id)
        {
            throw new NotImplementedException();
        }

        public Task SaveChanges()
        {
            throw new NotImplementedException();
        }

        public Task Update(TEntity obj, bool saved = true)
        {
            throw new NotImplementedException();
        }
    }
}
